﻿using Moq;
using NUnit.Framework;
using OpenWaves.ImageTransformations;

namespace OpenWaves.UnitTests.ImageTransformations
{
    [TestFixture]
    public class StretchTransformationTests
    {
        [Test]
        public void StretchTransformation_survives_serialization_deserialization_roundtrip()
        {
            var transformation = new StretchTransformation(100, 100);

            Assert.That(ImageTransformation.Parse(transformation.ToString()), Is.EqualTo(transformation));            
        }

        [Test]
        public void StretchTransformation_calls_Scale()
        {
            var transformation = new StretchTransformation(10, 10);
            var imageMock = new Mock<IImage>(MockBehavior.Strict);
            imageMock.Setup(i => i.Width).Returns(100);
            imageMock.Setup(i => i.Height).Returns(100);
            imageMock.Setup(i => i.Scale(10, 10)).Verifiable();

            transformation.ApplyToImage(imageMock.Object);

            imageMock.Verify();
        }
    }
}